﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLNHASACH.DTO;
using QLNHASACH.DataAccessLayer.ObjectDAO;

namespace QLNHASACH.BussinessLayer
{
    class KhachHangBUS
    {
        public static DataTable LayDSKhachHang()
        {
            return KhachHangDAO.LayDSKhachHang();
        }
        public static bool ThemKhachHang(KhachHangDTO khach)
        {
            if(KhachHangDAO.ThemKhachHang(khach))
                return true;
            return false;
        }
        public static bool XoaMotKhachHang(KhachHangDTO khach)
        {
            if (KhachHangDAO.KiemTraTonTai(khach) == true)
            {
                if (KhachHangDAO.XoaMotKhachHang(khach))
                    return true;
            }
            return false;
        }
        public static bool CapNhatKhachHang(KhachHangDTO khach)
        {
            if (KhachHangDAO.KiemTraTonTai(khach) == true)
            {
                if (KhachHangDAO.CapNhatKhachHang(khach))
                    return true;
            }
            return false;
        }
        //tim kiem
        public static DataTable TimTheoTen(string strSearch)
        {
            return KhachHangDAO.TimTheoTen(strSearch);
        }
        public static DataTable TimTheoSDT(string strSearch)
        {
            return KhachHangDAO.TimTheoSDT(strSearch);
        }
        public static DataTable TimTheoEmail(string strSearch)
        {
            return KhachHangDAO.TimTheoEmail(strSearch);
        }
    }
}
